/**
 * Created by WYH on 17/4/20.
 */
angular.module('tribalc').service('RentPlanItemModel', [
    'TimeFormat', function (TimeFormat) {


        var RentPlanItem = function (object) {

            var self = this;

            init();

            function init() {
                if (object) {
                    self.id = object.id || null;
                    self.protocolId = object.protocolId || null;
                    self.plannedTime = object.plannedTime || null;
                    self.plannedRental = object.plannedRental || null;
                    self.actualTime = object.actualTime || null;
                    self.actualPay = object.actualPay || null;
                    self.bankSerialNum = object.bankSerialNum || null;
                    self.finished = object.finished || null;
                }

            }
        };

        RentPlanItem.prototype.getPlannedTime = function () {
            return this.plannedTime ? TimeFormat.changeIntToYearTime(this.plannedTime) : '';
        };

        RentPlanItem.prototype.getActualTime = function () {
            return this.actualTime ? TimeFormat.changeIntToYearTime(this.actualTime) : '';
        };

        RentPlanItem.prototype.getFinishedStr = function () {
            return this.finished ? '正常' : '待缴全';
        };

        RentPlanItem.setupPlanItemList = function (array) {
            var list = [];
            array.forEach(function (value) {
                var planItem = new RentPlanItem(value);
                list.push(planItem);
            });
            return list;
        };


        return RentPlanItem;



    }
]);